import 'package:flutter/material.dart';

class Avatar extends StatelessWidget {
  final double size;
  final bool isRound; // 新增圆角控制参数
  const Avatar({
    super.key,
    this.size = 30,
    this.isRound = false, // 默认不启用圆角
  });

  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: Alignment.center,
      children: [
        ClipRRect(
          borderRadius:
              isRound ? BorderRadius.circular(size / 2) : BorderRadius.zero,
          child: Image.asset('lib/assets/images/icon.png',
              width: size, height: size),
        ),
        Positioned(
          child: ClipRRect(
            borderRadius:
                isRound ? BorderRadius.circular(size / 2) : BorderRadius.zero,
            child: Image.asset(
              'lib/assets/images/star.gif',
              width: size,
              height: size,
              fit: BoxFit.fill,
            ),
          ),
        ),
      ],
    );
  }
}
